Hello, I'm having issues placing the "ok" button to the right of the 'close' button, I want both to be to on the right hand side while being together. Any help would be appreciated. Thank you.
// dxl dialogs
DB dlg = null
// dxl elements
DBE dbeTree, dbeList, dbeSplitter, okBtnDBE, clBtnDBE
// memubar
DBE mb, sb
int sizes[] = {150, 300}
// constants
const string SARR_DUMMY[] = {}
// constants
const int TREE_WIDTH = 150
const int TREE_HEIGHT = 10
const int LIST_WIDTH = 300
const int LIST_HEIGHT = 10
string entries[] = {"Size",
">Small",
">Normal",
">Large",
"Style",
">Bold",
">Italic"}
char mn[] = {'S',
'm',
'N',
'L',
't',
'B',
'I'}
char hot[] = {ddbNone,
ddbNone,
ddbNone,
ddbNone,
ddbNone,
ddbNone,
ddbNone}
string help[] = {"Set size",
"Small fonts",
"Normal fonts",
"Large fonts",
"Set style",
"Bold font",
"Italic font"}
string inactive[] = {"Never",
"Never",
"Never",
"Never",
"Never",
"Never",
"Never"}
Sensitivity sensitive(int index) {
if (index == 2 || index == 6)
return ddbChecked
return ddbAvailable
}
void cb(int index) {
ack "Menu " help[index] " activated"
}
void doClose(DB x) {
hide x
}
void doClose(DBE x) {
hide dlg
release dlg
}
void okCB(DBE x) {
}
// create dialog
dlg = create("Test", styleCentered)
mb = menuBar(dlg)
addMenu(mb, "Files", 'F', entries, mn, hot, help, inactive, sensitive, cb)
sb = statusBar(dlg, "Initial", sizes)
// tree
dbeTree = treeView(dlg, 0, TREE_WIDTH, TREE_HEIGHT)
dbeTree->"top"->"form"
dbeTree->"left"->"form"
dbeTree->"bottom"->"unattached"
dbeTree->"right"->"unattached"
// list
dbeList = listView(dlg, 0, LIST_WIDTH, LIST_HEIGHT, SARR_DUMMY)
dbeList->"top"->"aligned"->dbeTree
dbeList->"left"->"unattached"
dbeList->"bottom"->"unattached"
dbeList->"right"->"flush"
// splitter
dbeSplitter = splitter(dlg, dbeTree, dbeList, 4)
dbeSplitter->"top"->"form"
dbeSplitter->"left"->"unattached"
dbeSplitter->"bottom"->"unattached"
dbeSplitter->"right"->"unattached"
//okBtnDBE = button(dlg, "OK", okCB)
//okBtnDBE->"top"->"unattached"
//okBtnDBE->"left"->"unattached"
//okBtnDBE->"right"->"spaced"->clBtnDBE
//okBtnDBE->"bottom"->"form"
close(dlg, false, doClose)
clBtnDBE = button(dlg, "Close", doClose)
clBtnDBE->"top"->"spaced"->dbeTree
clBtnDBE->"left"->"unattached"
clBtnDBE->"right"->"form"
clBtnDBE->"bottom"->"form"
realize dlg
{
// information is displayed over a single
// column
insertColumn(dbeList, 0, "Name", LIST_WIDTH - 20, null)
}
show dlg
EHcnck - Fri Sep 02 20:46:11 EDT 2016 |
Re: DBE placement issue I think the easiest solution is to use the apply() function instead of the button() function. This, however, will create the buttons in the bottom right part of the DB in its own section (where the standard close button usually is at).
Is that good enough for you? |
Re: DBE placement issue O.Wilkop - Sat Sep 03 09:40:37 EDT 2016 I think the easiest solution is to use the apply() function instead of the button() function. This, however, will create the buttons in the bottom right part of the DB in its own section (where the standard close button usually is at).
Is that good enough for you? That would work but it doesn't display right when using a status bar. |
Re: DBE placement issue - delete the 'close' button "void close(DB box, bool false, void closeAction(DB))" - create a new 'ok' button "void ok(DB box, "ok", void callback(DB))" - optional: create a new 'close' button with "void apply(DB box, "close", void callback(DB))" (I have not tried it!) |
Re: DBE placement issue Hi EHcnck,
Try changing your original code to the following. close(dlg, false, doClose) okBtnDBE = button(dlg, "OK", okCB) okBtnDBE ->"top"->"spaced"->dbeSplitter okBtnDBE ->"left"->"unattached" okBtnDBE ->"right"->"form" okBtnDBE ->"bottom"->"form" clBtnDBE = button(dlg, "Close", doClose) clBtnDBE->"right"->"flush"->okBtnDBE clBtnDBE->"left"->"unattached" clBtnDBE->"top"->"aligned"->okBtnDBE clBtnDBE->"bottom"->"form" This should do it...
Regards, M_vdLaan |
Re: DBE placement issue M_vdLaan - Mon Sep 05 09:23:14 EDT 2016 Hi EHcnck,
Try changing your original code to the following. close(dlg, false, doClose) okBtnDBE = button(dlg, "OK", okCB) okBtnDBE ->"top"->"spaced"->dbeSplitter okBtnDBE ->"left"->"unattached" okBtnDBE ->"right"->"form" okBtnDBE ->"bottom"->"form" clBtnDBE = button(dlg, "Close", doClose) clBtnDBE->"right"->"flush"->okBtnDBE clBtnDBE->"left"->"unattached" clBtnDBE->"top"->"aligned"->okBtnDBE clBtnDBE->"bottom"->"form" This should do it...
Regards, M_vdLaan Hi M_vdLaan, Thanks you very much for this response. I was almost sure this was a limitation. I have made a minor alteration so that the OK butt=n is before the close button: // tree dbeTree = treeView(dlg, 0, TREE_WIDTH, TREE_HEIGHT) dbeList = listView(dlg, 0, LIST_WIDTH, LIST_HEIGHT, SARR_DUMMY) dbeSplitter = splitter(dlg, dbeTree, dbeList, 4) clBtnDBE = button(dlg, "Close", doClose) okBtnDBE = button(dlg, "OK", okCB) close(dlg, false, doClose) dbeTree->"top"->"form" dbeTree->"left"->"form" dbeTree->"bottom"->"unattached" dbeTree->"right"->"unattached" // list dbeList->"top"->"aligned"->dbeTree dbeList->"left"->"unattached" dbeList->"bottom"->"unattached" dbeList->"right"->"flush" // splitter dbeSplitter->"top"->"form" dbeSplitter->"left"->"unattached" dbeSplitter->"bottom"->"unattached" dbeSplitter->"right"->"unattached" clBtnDBE->"top"->"spaced"->dbeSplitter clBtnDBE->"left"->"unattached" clBtnDBE->"right"->"form" clBtnDBE->"bottom"->"form" okBtnDBE ->"right"->"flush"->clBtnDBE okBtnDBE ->"left"->"unattached" okBtnDBE ->"top"->"aligned"->clBtnDBE okBtnDBE ->"bottom"->"form" realize dlg Hope thats ok. Thanks again for this, very helpful |
Re: DBE placement issue ChrisHardy - Mon Sep 05 20:47:01 EDT 2016 Hi M_vdLaan, Thanks you very much for this response. I was almost sure this was a limitation. I have made a minor alteration so that the OK butt=n is before the close button: // tree dbeTree = treeView(dlg, 0, TREE_WIDTH, TREE_HEIGHT) dbeList = listView(dlg, 0, LIST_WIDTH, LIST_HEIGHT, SARR_DUMMY) dbeSplitter = splitter(dlg, dbeTree, dbeList, 4) clBtnDBE = button(dlg, "Close", doClose) okBtnDBE = button(dlg, "OK", okCB) close(dlg, false, doClose) dbeTree->"top"->"form" dbeTree->"left"->"form" dbeTree->"bottom"->"unattached" dbeTree->"right"->"unattached" // list dbeList->"top"->"aligned"->dbeTree dbeList->"left"->"unattached" dbeList->"bottom"->"unattached" dbeList->"right"->"flush" // splitter dbeSplitter->"top"->"form" dbeSplitter->"left"->"unattached" dbeSplitter->"bottom"->"unattached" dbeSplitter->"right"->"unattached" clBtnDBE->"top"->"spaced"->dbeSplitter clBtnDBE->"left"->"unattached" clBtnDBE->"right"->"form" clBtnDBE->"bottom"->"form" okBtnDBE ->"right"->"flush"->clBtnDBE okBtnDBE ->"left"->"unattached" okBtnDBE ->"top"->"aligned"->clBtnDBE okBtnDBE ->"bottom"->"form" realize dlg Hope thats ok. Thanks again for this, very helpful Hi Chris,
Sure, no problem. That would probably be the more expected way, putting the OK to the left of the Close. It's just that the OP requested (I think) the OK button to be on the right of the Close. Whatever works for you... ;-)
M_vdLaan |